maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=tanka
pkgver=0.28.4
pkgrel=0
pkgdesc="Flexible, reusable and concise configuration for Kubernetes"
url="https://tanka.dev"
# blocked by kubectl (kubernetes)
arch="all !armhf !riscv64 !loongarch64"
license="Apache-2.0"
depends="kubectl"
makedepends="go"
checkdepends="go-jsonnet"
source="$pkgname-$pkgver.tar.gz::https://github.com/grafana/tanka/archive/refs/tags/v$pkgver.tar.gz"
options="net" # download Go modules

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -v \
		-ldflags "-X github.com/grafana/tanka/pkg/tanka.CurrentVersion=v$pkgver" \
		./cmd/tk
}

check() {
	# /pkg/helm test requires helm.
	# Tests timeout with helm installed.
	# shellcheck disable=2046
	go test $(go list ./... | grep -v /pkg/helm)
}

package() {
	install -Dm755 tk -t "$pkgdir"/usr/bin/
}

sha512sums="
6a4efec34ad0d6ade1e4cc8b51b121f8c00c4ff729fdb409d5d4a54b6d667b8f0e4b3e21a1a16c6acdad85815293d6cbd601a87d325387a440321004c0e6b5b3  tanka-0.28.4.tar.gz
"
